<?php
/**
 * 前端积分相关显示
 * Created by PhpStorm.
 * User: hls
 * Date: 2016/3/11
 * Time: 14:57
 */
namespace Wap\Controller;
use Wap\BaseController;
use Common\Model\PointModel;

class PointController extends BaseController {



    /**
     * pointDetail 积分明细 查看用户的积分明细
     */
    public function pointDetail(){
        $uid = session('uid');

        $mReturn=PointModel::getLogList($uid,1,C('LIST_PAGE_SIZE'));
        $list=$mReturn['data'];

        $operationType = C('OPT_TYPE');
        $this->smarty->assign('action', $operationType);
        $this->smarty->assign('list', $list);
        $this->smarty->assign('next', $mReturn['nextPage']);

        //是否当日首次签到
        signAssignWap($uid,$this->smarty);

        $pointRuleURL=C('POINT_RULE_URL');
        if(!$pointRuleURL){
            $pointRuleURL=U('Point/rule');
        }
        $this->smarty->assign('POINT_RULE_URL',$pointRuleURL);
        
        $this->smarty->assign('title',C('SITE_NAME'));

        $this->smarty->display('Point_v2/pointDetail.html');
    }


    /**
     * pointDetailMORE 积分明细加载更多ajax接口
     */
    public function pointDetailMore(){
        $p=I('post.p',2,'int');
        $uid = session('uid');

        $mReturn=PointModel::getLogList($uid,$p,C('LIST_PAGE_SIZE'));
        $list=$mReturn['data'];

        $operationType = C('OPT_TYPE');
        $this->smarty->assign('action', $operationType);
        $this->smarty->assign('list',$list);
        $result=array(
            'data'=>$this->smarty->fetch('Point_v2/pointDetailItem.html'),
        );
        $this->ajaxReturn($result) ;
    }


    /**
     * rule 积分规则
     */
    public function rule(){
        $uid = session("uid")+0;
        //是否当日首次签到
        signAssignWap($uid,$this->smarty);

        $this->smarty->display('PointMall_v2/pointRule.html');
    }


}